package com.cai.mvvm.model;

import com.mvvm.library.base.BaseModel;
import com.mvvm.library.base.BaseObserver;

import java.util.ArrayList;
import java.util.List;


/**
 * @创建时间：2023/2/22
 * @作者：小蔡
 * @功能介绍：
 */
public class MainModel extends BaseModel {
    private static MainModel instance;

    public static MainModel getInstance() {
        if (instance == null) {
            instance = new MainModel();
        }
        return instance;
    }


    /**
     * @param baseObserver 测试列表数据
     */
    public void getItemList(BaseObserver<List<String>> baseObserver) {
        List<String> objects = new ArrayList<>();
        objects.add("标题");
        objects.add("数据");
        objects.add("内容");
        baseObserver.onSuccess(objects);

        //http 示例
//        addDisposable(retrofitService.createRs(Api.class).login(Api.postRawObj("参数")), new BaseObserver<BaseBean<Object>>() {
//            @Override
//            public void onSuccess(BaseBean<Object> bean) {
//                baseObserver.onSuccess(bean.getResultData());
//            }
//
//            @Override
//            public void onError(String msg) {
//                baseObserver.onError(msg);
//            }
//
//        });
    }

}
